package com.app.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.app.dao.ImagesDao;
import com.app.entity.Images;

@Repository
public class ImagesDaoImpl extends HibernateDaoSupport implements ImagesDao {
	@SuppressWarnings("unchecked")
	@Transactional(readOnly=true)
	public List<Images> findAllNotInUseImages() {
		return getHibernateTemplate().find("select img from Images img where img.product is null");
	}

	@Transactional(readOnly=false)
	public void deleteAllImages(List<Images> imgList) {
		getHibernateTemplate().deleteAll(imgList);
	}

}
